import http from './http'

export function getHotCourses() {
  return http({
    url: '/hotcourses',
    method: 'get'
  })
}

export function getGoodCoursesNavList() {
  return http({
    url: '/goodcourses/navlist',
    method: 'get'
  })
}

export function getGoodCoursesList() {
  return http({
    url: '/goodcourses',
    method: 'get'
  })
}

export function getGoodCoursesListById(id) {
  return http({
    url: `/goodcourses/${id}`,
    method: 'get'
  })
}

export function getAllCoursesCategories() {
  return http({
    url: '/course/categories',
    method: 'get'
  })
}

export function getAllCourses() {
  return http({
    url: '/course/allcourse',
    method: 'get'
  })
}

export function getCurrentCourses(id) {
  return http({
    url: `/course/getcoursesbysecid/${id}`,
    method: 'get'
  })
}

export function getChildCategories(id) {
  return http({
    url: `/course/childcategories/${id}`,
    method: 'get'
  })
}

export function getChildCourses(id) {
  return http({
    url: `/course/getcoursesbychildid/${id}`,
    method: 'get'
  })
}
export function getClassroomList() {
  return http({
    url: '/classroom',
    method: 'get'
  })
}

export function getTopicList() {
  return http({
    url: '/topic',
    method: 'get'
  })
}

export function getTagList() {
  return http({
    url: '/tag',
    method: 'get'
  })
}

export function getHotGroupList() {
  return http({
    url: '/hotgroup',
    method: 'get'
  })
}

export function getHotTopicList() {
  return http({
    url: '/hottopic',
    method: 'get'
  })
}

export function getNewGroupList() {
  return http({
    url: '/newgroup',
    method: 'get'
  })
}

export function getAllGroupList() {
  return http({
    url: '/allgroup',
    method: 'get'
  })
}

export function getSearchGroupList(id, value) {
  return http({
    url: `/searchgroup/${id}`,
    method: 'get',
    params: { value }
  })
}

export function registerOneUser(body) {
  return http({
    url: '/register',
    method: 'post',
    data: body
  })
}

export function loginUser(body) {
  return http({
    url: '/login',
    method: 'post',
    data: body
  })
}

export function getCurrentUser() {
  return http({
    url: '/currentuser',
    method: 'get'
  })
}

export function UpdateUserInfo(body) {
  return http({
    url: '/updateuserinfo',
    method: 'post',
    data: body
  })
}
